<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{margin: 0; padding: 0;}
        .banner{
            width: 550px;
            height: 321px;
            border: 1px solid #f60;
            margin: 100px auto 0;
            position: relative;
        }
        .banner .pic a{
            position: absolute;
            left: 0;
            top: 0;
            display: none;
        }
        .banner a.show{
            display: block;
        }
        .banner .product_name{
            width: 100%;
            /*height: 32px;
            padding: 5px 0;*/
            position: absolute;
            left: 0;
            bottom: 0;
        }
        .banner .product_name a{
            display: block;
            width: 79px;
            height: 32px;
            padding: 5px 15px;
            background: #444;
            opacity: 0.7;
            float: left;
            margin-right: 1px;
            filter: alpha(opacity = 70);
            font-size: 12px;
            color: #fff;
            text-align: center;
        }
        .banner .product_name a.active{
            background:#37A7D7 url("img/QQ图片20180111145547.gif") no-repeat center 39px;
        }
    </style>
</head>
<body>
<div class="banner">
    <div class="pic">
        <a class="show" href="#"><img src="img/pic-1.jpg" alt=""></a>
        <a href="#"><img src="img/pic-2.jpg" alt=""></a>
        <a href="#"><img src="img/pic-3.jpg" alt=""></a>
        <a href="#"><img src="img/pic-4.jpg" alt=""></a>
        <a href="#"><img src="img/pic-5.jpg" alt=""></a>
    </div>
    <div class="product_name">
        <a href="#" class="active">相约情人节 全场119元起</a>
        <a href="#">新款上线 全场357元起</a>
        <a href="#">愤怒小鸟特卖 全场89元</a>
        <a href="#">男鞋促销第一 全场3.1折起</a>
        <a href="#">春季新品发布 全场4.1折起</a>
    </div>
</div>
</body>
</html>
<script src="js/jquery-1.10.1.js"></script>
<script>
    $(function () {
        //初始化一个全局变量
        var _index = 0;

        function slider(_index) {
            $(".banner .product_name a").eq(_index).addClass("active").siblings().removeClass("active");
            $(".banner .pic a").eq(_index).fadeIn().siblings().fadeOut();
        }

        $(".banner .product_name a").mouseover(function () {
            //获取当前鼠标移入元素的下标
            _index = $(this).index();
            slider(_index);
        })
        function change() {
            if(_index == 4){
                _index = 0;
            }else{
                _index++;
            }
            slider(_index);
        }
        var timer = setInterval(change,1000);

        $(".banner").hover(function () {
            clearInterval(timer);
        },function () {
            timer = setInterval(change,1000);
        })
    })
</script>